﻿@model BaseDetail
<form action='@Url.Action("Edit")' method="post" class="editForm">
<div style="height: 40px; line-height: 40px; padding: 0 10px;">
    <div class="pull-left" style="height: 40px; line-height: 40px;">
        <h2 id="bigTitle">
            @ViewBag.Title
        </h2>
    </div>
</div>
<hr />
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        标题：
    </div>
    <div class="span11">
        @Html.TextBoxFor(x => x.Name)
    </div>
</div>
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        摘要：
    </div>
    <div class="span11">
        @Html.TextAreaFor(x => x.Summary, 5, 20, null)
    </div>
</div>
@if (ViewBag.CateList != null)
{
    <div class="row" style="margin-top: 20px;">
        <div class="span1">
            类别：
        </div>
        <div class="span11">
            @Html.DropDownListFor(x => x.Cate.ID, new SelectList((IEnumerable<BaseCate>)ViewBag.CateList, "ID", "Name", Model.Cate == null ? null : (object)Model.Cate.ID), "选择...")
        </div>
    </div>
}
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        缩略图：
    </div>
    <div class="span11">
        <input type="file" name="file_upload" id="file_upload" />
        <div>
            图片尺寸： 170px*110px</div>
        @Html.HiddenFor(x => x.Image)
        @if (!string.IsNullOrWhiteSpace(Model.Image))
        {
            <img id="mImg" src="@Url.Content(ViewBag.ImageFolderName + Model.Image)" />
        }
        else
        {
            <img id="mImg" />
        }
    </div>
</div>
<div class="row" style="margin-top: 20px;">
    <div class="span1">
        正文：
    </div>
    <div class="span11">
        <textarea id="htmlContent" name="htmlContent" class="htmledit" cols="100" rows="8"
            style="visibility: hidden; height: 500px;">
            @ViewBag.HtmlContent
            </textarea>
    </div>
</div>
@Html.ValidationSummary()
<div class="row" style="margin-top: 20px;">
    <div class="span2 offset5">
        <input type="submit" id="Button1" class="btn  btn-primary  btn-large" value="保存" />
    </div>
    <div class="span2">
        <a href="@Url.Action("List")" class="btn btn-info  btn-large">
            <i class="icon-th-list icon-white"></i>返回列表</a>
    </div>
</div>
</form>
@section scripts{
    <script type="text/javascript">

        $(function () {
            $('#file_upload').uploadify({
                'swf': '@Url.Content("~/Content/uploadify-v3.1/uploadify.swf")',
                'uploader': '@Url.Action("Index", "Image")',
                'buttonText': '选择图片...',
                'fileTypeExts': '*.gif; *.jpg; *.png',
                'onUploadSuccess': function (file, data, response) {
                    var json = $.parseJSON(data);
                    document.getElementById('mImg').src = '@Url.Content("~/file/temp/")' + json.name;
                    document.getElementById('Image').value = json.name;
                }
            });
        });


        KindEditor.ready(function (K) {
            var editor1 = K.create('#Summary', {
                uploadJson: '@Url.Content("~/Content/kindeditor-4.1/asp.net/upload_json.ashx")',
                fileManagerJson: '@Url.Content("~/Content/kindeditor-4.1/asp.net/file_manager_json.ashx")',
                allowFileManager: true,
                items: [
						'fontname', 'fontsize', 'formatblock', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', 'lineheight', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
            });
        });


        KindEditor.ready(function (K) {
            var editor1 = K.create('#htmlContent', {
                uploadJson: '@Url.Content("~/Content/kindeditor-4.1/asp.net/upload_json.ashx")',
                fileManagerJson: '@Url.Content("~/Content/kindeditor-4.1/asp.net/file_manager_json.ashx")',
                allowFileManager: true,
                items: [
						'fontname', 'fontsize', 'formatblock', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', 'lineheight', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'emoticons', 'image', 'link']
            });
        });



    </script>
}
